package com.bocai.dahuatech.netutil;


import com.bocai.dahuatech.Bean.BaseBean;
import com.bocai.dahuatech.utils.UrlData;

import retrofit.http.Field;
import retrofit.http.FormUrlEncoded;
import retrofit.http.GET;
import retrofit.http.POST;
import retrofit.http.Query;
import rx.Observable;

public interface TestApi {
    /**
     * 会员注册
     * @param LoginName
     * @param Password
     * @param Phone
     * @param CompanyName
     * @param Province
     * @param City
     * @param Area
     * @param Address
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.REGISTE)
    Observable<BaseBean>  register(@Field("LoginName") String LoginName,  @Field("Password") String Password,@Field("Phone") String Phone,
                                  @Field("CompanyName") String CompanyName, @Field("Province") String Province,
                                  @Field("City") String City,@Field("Area") String Area,@Field("Address") String Address);

    /**
     * 分销商注册
     * @param LoginName
     * @param Password
     * @param Phone
     * @param CompanyName
     * @param Province
     * @param City
     * @param Area
     * @param Address
     * @param Distributor
     * @param ContractAmount
     * @param Contactor
     * @param ContactTel
     * @param ContactEmail
     * @param BusinessLicensePic
     * @param IDCardPic
     * @param TaxRegisterCertificatePic
     * @param OrganizationCertificatePic
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.INDIVIDUALREGISTE)
    Observable<BaseBean> individualRegist(@Field("LoginName") String LoginName,  @Field("Password") String Password,@Field("Phone") String Phone,
                                          @Field("CompanyName") String CompanyName, @Field("Province") String Province,
                                          @Field("City") String City,@Field("Area") String Area,@Field("Address") String Address,
                                          @Field("Distributor") String Distributor,@Field("DistributorCode") String DistributorCode,
                                          @Field("ContractAmount") String ContractAmount,@Field("Contactor") String Contactor,
                                          @Field("ContactTel") String ContactTel,@Field("ContactEmail") String ContactEmail,
                                          @Field("BusinessLicensePic") String BusinessLicensePic,
                                          @Field("IDCardPic") String IDCardPic,@Field("TaxRegisterCertificatePic") String TaxRegisterCertificatePic,
                                          @Field("OrganizationCertificatePic") String OrganizationCertificatePic);

    /**
     * 分销商认证
     * @param Id
     * @param Distributor
     * @param ContractAmount
     * @param Contactor
     * @param ContactTel
     * @param ContactEmail
     * @param BusinessLicensePic
     * @param IDCardPic
     * @param TaxRegisterCertificatePic
     * @param OrganizationCertificatePic
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.CERTIFIEDDISTRIBUTORS)
    Observable<BaseBean> certifiedDistributors(@Field("Id") int Id,
                                               @Field("Distributor") String Distributor,@Field("DistributorCode") String DistributorCode,
                                               @Field("ContractAmount") String ContractAmount, @Field("Contactor") String Contactor,
                                               @Field("ContactTel") String ContactTel,@Field("ContactEmail") String ContactEmail,
                                               @Field("BusinessLicensePic") String BusinessLicensePic,
                                               @Field("IDCardPic") String IDCardPic,@Field("TaxRegisterCertificatePic") String TaxRegisterCertificatePic,
                                               @Field("OrganizationCertificatePic") String OrganizationCertificatePic);

    /**
     * 检查用户名是否重复
     * @param loginName
     * @return
     */
    @GET(UrlData.CHECKUSERNAME)
    Observable<BaseBean>  userNameExit(@Query("loginName") String loginName);

    /**
     * 验证分销商是否已注册申请分销商
     * @param companyName
     * @param phone
     * @return
     */
    @GET(UrlData.CHECKCOMPANYNAME)
    Observable<BaseBean>  checkCompanyName(@Query("companyName") String companyName,@Query("phone") String phone);

    /**
     * 修改公司名称
     * @param companyName
     * @param id
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.UPDATACOMPANYNAME)
    Observable<BaseBean>  updataCompanyName(@Field("Id") int id,@Field("CompanyName") String companyName);


    /**
     * 根据省市获取代理商
     * @param province
     * @param city
     * @return
     */
    @GET(UrlData.GETCUSTOMER)
    Observable<BaseBean>  getCustomer(@Query("province") String province,@Query("city") String city);

    /**
     * 检查分销商是否正确
     * @param province
     * @param city
     * @param customerName
     * @return
     */
    @GET(UrlData.CHECKCUSTOMER)
    Observable<BaseBean>  checkCustomer(@Query("province") String province,@Query("city") String city,@Query("customerName") String customerName);

    /**
     * 登录
     * @param LoginName
     * @param Password
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.LOGIN)
    Observable<BaseBean> login (@Field("LoginName") String LoginName, @Field("Password") String Password,@Field("Android") String Android);

    /**
     * 获取验证码
     * @param Phone
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.GETCODE)
    Observable<BaseBean> getCode (@Field("Phone") String Phone);

    /**
     * 修改密码
     * @param Id
     * @param OldPassword
     * @param NewPassword
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.CHANGEPWD)
    Observable<BaseBean> changePwd (@Field("Id") int Id, @Field("OldPassword") String OldPassword, @Field("NewPassword") String NewPassword);

    /**
     * 修改手机号
     * @param Id
     * @param Phone
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.CHANGEPHONE)
    Observable<BaseBean> updataPhone (@Field("Id") int Id, @Field("Phone") String Phone);

    /**
     * 重置密码
     * @param Phone
     * @param NewPassword
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.RESETPWD)
    Observable<BaseBean> resetPwd (@Field("Phone") String Phone, @Field("NewPassword") String NewPassword);


    /**
     * 获取会员信息
     * @param userId
     * @return
     */
    @GET(UrlData.PERSONINFO)
    Observable<BaseBean> getPersonInfo (@Query("userId") int userId);


    /**
     * 获取促销页图片
     * @return
     */
    @GET(UrlData.PROMOTIONPIC)
    Observable<BaseBean> getPromotionPic ();

    /**
     * 获取新闻列表
     * @param columnsId
     * @param pageSize
     * @param page
     * @return
     */
    @GET(UrlData.GETNEWS)
    Observable<BaseBean> getNewsList (@Query("columnsId") int columnsId,@Query("pageSize") int pageSize,@Query("page") int page);

    /**
     * 首页Banner
     * @return
     */
    @GET(UrlData.HOMEBANNER)
    Observable<BaseBean> getHomeBanner (@Query("customerCode") String customerCode);

    /**
     * 获取订单列表
     * @param customerCode
     * @return
     */
    @GET(UrlData.ORDERLIST)
    Observable<BaseBean> getOrderList (@Query("customerCode") String customerCode,@Query("fBillNo") String fBillNo,@Query("fModel") String fModel,
                                       @Query("fStatus") String fStatus,@Query("pages") int pages);

    /**
     * 订单详情
     * @param fid 订单主键
     * @param customerCode
     * @return
     */
    @GET(UrlData.ORDERDETAIL)
    Observable<BaseBean> getOrderDetail (@Query("fid") int fid,@Query("customerCode") String customerCode);

    /**
     * 删除订单
     * @param fid
     * @param userId
     * @param customerCode
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.DELETEORDER)
    Observable<BaseBean> deleteOrder (@Field("fid") int fid, @Field("userId") int userId, @Field("customerCode") String customerCode);

    /**
     * 确认收货
     * @param fid
     * @param userId
     * @param customerCode
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.RECEIVEGOODS)
    Observable<BaseBean> receiveGoods (@Field("fid") int fid, @Field("userId") int userId, @Field("customerCode") String customerCode);

    /**
     * 取消订单
     * @param FUserFid
     * @param Fid
     * @param OptFlag  1表示修改  2表示删除
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.ORDERCANCEL)
    Observable<BaseBean> orderCancel (@Field("FUserFid") int FUserFid, @Field("Fid") int Fid, @Field("OptFlag") int OptFlag,@Field("CustomerCode") String CustomerCode );

    /**
     * 获取积分列表
     * @param customerCode
     * @param fBillNo
     * @param curpage
     * @return
     */
    @GET(UrlData.GETPOINTLIST)
    Observable<BaseBean> getPointList (@Query("customerCode") String customerCode,@Query("fBillNo") String fBillNo,@Query("curpage") int curpage);

    /**
     * 获取华积分总分
     * @param customerCode
     * @return
     */
    @GET(UrlData.GETPOINT)
    Observable<BaseBean> getPoint (@Query("customerCode") String customerCode);

    /**
     * 获取收货地址列表
     * @param customerCode
     * @return
     */
    @GET(UrlData.GETADDRESSLIST)
    Observable<BaseBean> getAddrList (@Query("customerCode") String customerCode);

    /**
     * 删除地址
     * @param customerCode
     * @param addressId
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.DELETEADDRESS)
    Observable<BaseBean> deleteAddr (@Field("customerCode") String customerCode, @Field("addressId") int addressId);

    /**
     * 设置默认地址
     * @param customerCode
     * @param addressId
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.SETDAFAULTADDRESS)
    Observable<BaseBean> setDefaltAddr (@Field("customerCode") String customerCode, @Field("addressId") int addressId);

    /**
     * 编辑/添加收货地址
     * @param FConsignee
     * @param FProvinceID
     * @param FCityID
     * @param FAreaID
     * @param PCAName
     * @param FAddress
     * @param FZipCode
     * @param FMobilePhone
     * @param FCustomerCode
     * @param FCreatorID
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.EDITADDRESS)
    Observable<BaseBean> editAddr(@Field("FConsignee") String FConsignee, @Field("FProvinceID") int FProvinceID, @Field("FCityID") int FCityID,
                                  @Field("FAreaID") int FAreaID, @Field("PCAName") String  PCAName ,  @Field("FAddress") String  FAddress, @Field("FZipCode") String  FZipCode,
                                  @Field("FMobilePhone") String  FMobilePhone, @Field("FCustomerCode") String  FCustomerCode, @Field("FCreatorID") int  FCreatorID);

    /**
     * 我的兑换列表
     * @param customerCode
     * @param fItemName
     * @param page
     * @return
     */
    @GET(UrlData.MYEXCAHNGELIST)
    Observable<BaseBean> getPointExchangeList (@Query("customerCode") String customerCode,@Query("fItemName") String fItemName,@Query("page") String page);

    /**
     *积分商城
     * @param curPage
     * @param pageSize
     * @return
     */
    @GET(UrlData.POINTSHOP)
    Observable<BaseBean> getPointShop (@Query("curPage") int curPage,@Query("pageSize") int pageSize);

    /**
     * 积分兑换
     * @param Fid
     * @param FPoint
     * @param FNum
     * @param FAddressID
     * @param FUserID
     * @param customerCode
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.TOEXCHANGE)
    Observable<BaseBean> toExchange(@Field("Fid") int Fid, @Field("FPoint") double FPoint,@Field("FNum") int FNum,
                                    @Field("FAddressID") int FAddressID,@Field("FUserID") int FUserID, @Field("customerCode") String customerCode);


    /**
     * 获取购物车列表
     * @param userId
     * @return
     */
    @GET(UrlData.SHOPCARDLIST)
    Observable<BaseBean> getShopcardList (@Query("userId") String userId);

    /**
     * 去结算时购物车列表
     * @param userFid  用户主键
     * @return
     */
    @GET(UrlData.COMMITCARDLIST)
    Observable<BaseBean> getSummitCartList (@Query("userFid") String userFid);


    /**
     * 购物车结算
     * @param curCartId
     * @param customerCode
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.SHOPCARDACOUT)
    Observable<BaseBean> toAcount(@Field("curCartId") int curCartId, @Field("customerCode") String customerCode);


    /**
     * 加入购物车
     * @param userRole
     * @param customerCode
     * @param userFid
     * @param ProFid
     * @param productFid
     * @param fitsFid
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.ADDTOCARD)
    Observable<BaseBean> addToCard(@Field("userRole") int userRole, @Field("customerCode") String customerCode, @Field("userFid") int userFid,
                                   @Field("ProFid") String ProFid, @Field("productFid") String productFid, @Field("fitsFid") String fitsFid);
    /**
     * 确认订单
     * @param userFid
     * @param curAddressId
     * @param curFOrderID
     * @param note
     * @param payway
     * @param customerCode
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.SAVEORDER)
    Observable<BaseBean> saveOrder(@Field("userFid") int userFid, @Field("curAddressId") int curAddressId, @Field("curFOrderID") int curFOrderID,
                                   @Field("note") String note, @Field("payway") String payway, @Field("customerCode") String customerCode);




    /**
     * 产品分类列表
     * @param parentId
     * @return
     */
    @GET(UrlData.PRODUCTSERIESLIST)
    Observable<BaseBean> getProductSeriesList (@Query("level") int level,@Query("parentId") int parentId);
//    Observable<BaseBean> getProductSeriesList ();

    /**
     *产品列表
     * @param seriesId
     * @param stype
     * @param key
     * @param curpage
     * @param pagesize
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.PRODUCTLIST)
    Observable<BaseBean> getProductList (@Field("seriesId") int seriesId,@Field("screen") int screen,@Field("stype") String stype,
                                         @Field("key") String key,@Field("curpage") int curpage,@Field("pagesize") int pagesize);

    /**
     * 获取促销产品列表
     * @param curpage
     * @param pagesize
     * @return
     */
    @GET(UrlData.PROMOTIONPRODUCTLIST)
    Observable<BaseBean> getPromotionProductList (@Query("foutModel") String foutModel,@Query("curpage") int curpage,@Query("pagesize") int pagesize);

    /**
     * 产品详情
     * @param productId
     * @return
     */
    @GET(UrlData.PRODUCTDETAIL)
    Observable<BaseBean> getProductDetail (@Query("productId") int productId);


    /**
     * 产品配件列表
     * @param productId
     * @return
     */
    @GET(UrlData.PRODUCTFITLIST)
    Observable<BaseBean> getProductFittingList(@Query("productId") int productId);

    /**
     * 获取产品型号规格列表
     * @param foutModel
     * @return
     */
    @GET(UrlData.GETPRODUCTQUDAOPARAMLIST)
    Observable<BaseBean> getProductQudaoParamList(@Query("foutModel") String foutModel);
    /**
     * 产品参数详情
     * @param productId
     * @return
     */
    @GET(UrlData.PRODUCTPARAMDETAIL)
    Observable<BaseBean> getProductParamDetail (@Query("productId") int productId);

    /**
     * 上传图片
     * @param Id
     * @param Avatar
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.UPLOADMEPHOTO)
    Observable<BaseBean> uploadPhoto (@Field("Id") int Id,@Field("Avatar") String Avatar);


    /**
     * 购物车删除、编辑数量
     * @param fEntryID
     * @param fQty
     * @param fStatus  0:取消选中；1:选中；2:删除
     * @param userFid
     * @param customerCode
     * @param cartNumber
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.SHOPCARDEDIT)
    Observable<BaseBean> getAfterCartInfoEdit (@Field("fEntryID") int fEntryID,@Field("fQty") int fQty,@Field("fStatus") int fStatus,
                                               @Field("userFid") int userFid,@Field("customerCode") String customerCode,@Field("cartNumber") int cartNumber);


    /**
     * 用户收藏列表
     * @param userId
     * @param curpage
     * @param pageSize
     * @return
     */
    @GET(UrlData.COLLECTIONLIST)
    Observable<BaseBean> getCollectionLsit (@Query("userId") int userId,@Query("curpage") int curpage,@Query("pageSize") int pageSize);

    /**
     * 获取省市区列表
     * @param level
     * @param parentId
     * @return
     */
    @GET(UrlData.GETPCA)
    Observable<BaseBean> getPCA (@Query("level") int level,@Query("parentId") int parentId);


    /**
     * 获取解决方案列表
     * @param category
     * @param curpage
     * @param pageSize
     * @return
     */
    @GET(UrlData.SOLUTIONLIST)
    Observable<BaseBean> getSolutionList(@Query("category") int category,@Query("curpage") int curpage,@Query("pageSize") int pageSize);

    /**
     * 新品速递列表
     * @return
     */
    @GET(UrlData.NEWPRODUCT)
    Observable<BaseBean> getNewProduct();

    /**
     * 新品速递前三
     * @return
     */
    @GET(UrlData.THREENEWPRODUCT)
    Observable<BaseBean> getThreeNewProduct();

    /**
     * 添加收藏
     * @param ForeignKey  当前收藏的内容主键
     * @param Link   当前收藏的内容地址
     * @param Type  1-解决方案  2-新闻   3-产品
     * @param MemberId  用户主键ID
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.ADDCOLLECTION)
    Observable<BaseBean> addCollection(@Field("ForeignKey") String ForeignKey,@Field("Link") String Link,@Field("Type") int Type,@Field("MemberId") int MemberId);


    /**
     *
     * @param ForeignKey
     * @param Link
     * @param Type
     * @param MemberId
     * @param SolutionType  收藏解决方案时需要填写： 1-IPC  2-HDCVI

     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.ADDCOLLECTION)
    Observable<BaseBean> addSolutioCollection(@Field("ForeignKey") String ForeignKey,@Field("Link") String Link,@Field("Type") int Type,@Field("MemberId") int MemberId,
                                       @Field("SolutionType") int SolutionType);

    /**
     * 删除收藏
     * @param id  收藏表主键Id
     * @return
     */
    @FormUrlEncoded
    @POST(UrlData.DELETECOLLECTION)
    Observable<BaseBean> deleteCollection(@Field("Id") String id);


    /**
     * 判断新闻、产品是否已收藏
     * @param ForeignKey
     * @param Type
     * @param MemberId
     * @return
     */

    @GET(UrlData.IFCOLLECTION)
    Observable<BaseBean> ifNewsCollection(@Query("ForeignKey") String ForeignKey,@Query("Type") int Type,@Query("MemberId") int MemberId);

    /**
     * 判断解决方案是否收藏
     * @param ForeignKey
     * @param Type
     * @param MemberId
     * @param SolutionType
     * @return
     */
    @GET(UrlData.IFCOLLECTION)
    Observable<BaseBean> ifSolutionCollection(@Query("ForeignKey") String ForeignKey,@Query("Type") int Type,@Query("MemberId") int MemberId,@Query("SolutionType") int SolutionType);

    /**
     * 根据省市获取咨询联系人
     * @param province
     * @param city
     * @return
     */
    @GET(UrlData.GETREMEMBERCONTACT)
    Observable<BaseBean> getMemberContact(@Query("province") String province,@Query("city") String city);

    /**
     * 版本更新
     * @param type
     * @return
     */
    @GET(UrlData.GETVERSION)
    Observable<BaseBean> getVersion(@Query("type") int type);



}
